package com.exception;

import com.comment.CommentResult;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalException {

    @ExceptionHandler(ServiceException.class)
    @ResponseBody
    public CommentResult<Void> serviceException(ServiceException e) {
        return CommentResult.error(500, e.getMessage());
    }

}